package com.my.test.java.two.moredata.datas.share;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

import com.my.test.java.two.moredata.datas.AbsPreparedStatement;
import com.my.test.java.two.moredata.datas.executor.ExecuteUpdateExecutor;
import com.my.test.java.two.moredata.datas.executor.QueryExecutor;
import com.my.test.java.two.moredata.datas.rule.DataSourceAg;
import com.my.test.java.two.moredata.datas.rule.TableRuleAg;
import com.my.test.java.two.moredata.datas.sqlrotu.DataNodeSQLRotu;
import com.my.test.java.two.moredata.datas.sqlrotu.NodeSQLBean;

public class SharePreparedStatement extends AbsPreparedStatement{

	private TableRuleAg tableRule;
	private DataSourceAg dataSourceAg;
	private String sql;
	private Map<String,Connection> map;
	
	public SharePreparedStatement(){
		
	}
	
	public SharePreparedStatement(TableRuleAg tableRule, DataSourceAg dataSourceAg,String sql,Map<String,Connection> map){
		this.tableRule = tableRule;
		this.dataSourceAg = dataSourceAg;
		this.sql = sql;
		this.map = map;
	}
	
	public ShareResultSet executeQuery() {
		return new QueryExecutor().exec(
				new ShardeContext(tableRule,dataSourceAg,sql,map,this.params));
    }
	public int executeUpdate() {
		return new ExecuteUpdateExecutor().exec(
				new ShardeContext(tableRule,dataSourceAg,sql,map,this.params));
	}
}
